package com.entity;

// Generated 09.02.2014 20:16:29 by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * SubtasksEntity generated by hbm2java
 */
@Entity
@Table(name = "subtasks", catalog = "jiraexcel")
public class SubtasksEntity implements java.io.Serializable {

	private Integer idSubtasks;
	private FieldsEntity fieldsEntity;
	private Set<IssueEntity> issueEntities = new HashSet<IssueEntity>(0);

	public SubtasksEntity() {
	}

	public SubtasksEntity(FieldsEntity fieldsEntity) {
		this.fieldsEntity = fieldsEntity;
	}

	public SubtasksEntity(FieldsEntity fieldsEntity,
			Set<IssueEntity> issueEntities) {
		this.fieldsEntity = fieldsEntity;
		this.issueEntities = issueEntities;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_subtasks", unique = true, nullable = false)
	public Integer getIdSubtasks() {
		return this.idSubtasks;
	}

	public void setIdSubtasks(Integer idSubtasks) {
		this.idSubtasks = idSubtasks;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_fields", nullable = false)
	public FieldsEntity getFieldsEntity() {
		return this.fieldsEntity;
	}

	public void setFieldsEntity(FieldsEntity fieldsEntity) {
		this.fieldsEntity = fieldsEntity;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "subtasks_has_issue", catalog = "jiraexcel", joinColumns = { @JoinColumn(name = "subtasks_id_subtasks", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "issue_id_issue", nullable = false, updatable = false) })
	public Set<IssueEntity> getIssueEntities() {
		return this.issueEntities;
	}

	public void setIssueEntities(Set<IssueEntity> issueEntities) {
		this.issueEntities = issueEntities;
	}

}
